Skip to content

testTzSys: fix test suite for non-glibc when using TZDIR#29

Open
sternenseemann wants to merge 1 commit intonilcons:masterfrom
sternenseemann:posix-tzset
Open

testTzSys: fix test suite for non-glibc when using TZDIR#29
sternenseemann wants to merge 1 commit intonilcons:masterfrom
sternenseemann:posix-tzset

Conversation

@sternenseemann
Copy link

If TZDIR was set to a directory differing from the system timezone
directory, the testTZSys test suite would fail on certain timezones
in certain configurations. We discovered this when building the tz
packaged in nixpkgs on macOS: We would provide our packaged tzdata via
TZDIR, but /usr/share/zoneinfo would still be accessible. Since Apple's
tzdata seem to be outdated, the tests fail consistently. This is because
the tzset(3) implementation of Apple's libSystem is “only”
POSIX-conforming and doesn't support the glibc invention of TZDIR. They
are not alone with this -- musl doesn't support it as well.

To work around this we can use POSIX behavior, however: If TZ is
prefixed with a ':', we can pass an absolute path and rely on the lookup
behavior implemented in tz itself.

Tested this change on macOS (with libSystem) and on NixOS (with glibc). A new release would be neat, so we don't have to carry this patch around for too long.

If TZDIR was set to a directory differing from the system timezone
directory, the testTZSys test suite would fail on certain timezones
in certain configurations. We discovered this when building the tz
packaged in nixpkgs on macOS: We would provide our packaged tzdata via
TZDIR, but /usr/share/zoneinfo would still be accessible. Since Apple's
tzdata seem to be outdated, the tests fail consistently. This is because
the tzset(3) implementation of Apple's libSystem is “only”
POSIX-conforming and doesn't support the glibc invention of TZDIR. They
are not alone with this -- musl doesn't support it as well.

To work around this we can use POSIX behavior, however: If TZ is
prefixed with a ':', we can pass an absolute path and rely on the lookup
behavior implemented in tz itself.
@ysangkok
Copy link

Thank you, I took over the library and merged and released this as part of v0.1.3.6, here is my fork: https://github.com/ysangkok/haskell-tz/commits/master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants